package com.usian.admin.job;

import com.usian.admin.feign.WemediaFeign;
import com.usian.admin.service.WemediaNewsAutoScanService;
import com.xxl.job.core.biz.model.ReturnT;
import com.xxl.job.core.handler.annotation.XxlJob;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.List;

@Component
public class WeMediaNewsAutoScanJob {

    @Autowired
    private WemediaFeign wemediaFeign;

    @Autowired
    private WemediaNewsAutoScanService wemediaNewsAutoScanService;

    @XxlJob("myjob")
    public ReturnT<String> myjob(String param){

        List<Integer> release = wemediaFeign.findRelease();
        if(release.size()>0){
            for(Integer id : release){
                wemediaNewsAutoScanService.autoScanByMediaNewsId(id);
            }
        }
        return ReturnT.SUCCESS;
    }
}
